<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Device485Model extends Model
{
    use HasFactory, SoftDeletes;

    protected $table = 'device_485_model';

    protected $fillable = ['name', 'read_code', 'write_code', 'baud', 'ror_second'];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function device()
    {
        return $this->belongsToMany(Device::class, 'device_485', 'model_id', 'device_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function attr()
    {
        return $this->hasMany(Device485Attr::class, 'pid');
    }


}
